package com.company.Quicksort;

public class Quicksort {

    public static void main(String[] args) {

        int[] arrs = {1,34,1,23,111,2545,3452,341,3432,35,657,1,23};

        srot(arrs,0,arrs.length-1);

        for (int arr : arrs) {

            System.out.println(arr);

        }




    }

    private static void srot(int[] arrs, int left, int right) {

        if (left < right)//这个提交
        {

            int lingshi = arrs[left];

            int i = left;

            int j = right;

            while (i != j) {

                while (j > i && arrs[j] > lingshi) {

                    j--;

                }

                if (i < j)
                {
                    arrs[i] = arrs[j];

                }

                while (j > i && arrs[i] <= lingshi)
                {
                    i++;
                }

                if (i < j)
                {
                    arrs[j] = arrs[i];
                }
            }

            arrs[i] = lingshi;
            srot(arrs,left,i-1);
            srot(arrs,i+1,right);

        }

    }

}


